package com.example.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.pojo.Examine;
import com.example.mapper.ExamineMapper;
import com.example.service.IExamineService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.vo.ExamineVo;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;

import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author lyj
 * @since 2023-02-15
 */
@Service
public class ExamineServiceImpl extends ServiceImpl<ExamineMapper, Examine> implements IExamineService {

    @Override
    public IPage<ExamineVo> findExamineVoPage(Map map, Page<ExamineVo> page) {
        QueryWrapper<ExamineVo> wrapper = new QueryWrapper<>();
        wrapper.apply("e.del_flag=0")
                .eq(!ObjectUtils.isEmpty(map.get("officeId")),"so.id",map.get("officeId"))
                .eq(!ObjectUtils.isEmpty(map.get("type")),"e.type",map.get("type"))
                .like(!ObjectUtils.isEmpty(map.get("username")),"su.name",map.get("username"));

        return baseMapper.findAllExamineVo(page,wrapper);
    }
}
